import scVerify from '@/components/scVerify/index.vue'
import scUpload from '@/components/scUpload/index.vue'
import scTable from '@/components/scTable/index.vue'

import time from '@/directives/time'
import drag from '@/directives/drag'

import * as elIcons from '@element-plus/icons-vue'
import * as scIcons from './assets/icons'

export default {
	install(app: any) {
		// 注册全局组件
		app.component('scVerify', scVerify)
		app.component('scUpload', scUpload)
		app.component('scTable', scTable)

		// 注册全局指令
		app.directive('time', time)
		app.directive('drag', drag)

		// 统一注册sc-icon图标
		Object.entries(scIcons).forEach(([iconName, iconComponent]) => {
			app.component(`ScIcon${iconName}`, iconComponent)
		})
		// 统一注册el-icon图标
		Object.entries(elIcons).forEach(([iconName, iconComponent]) => {
			app.component(`ElIcon${iconName}`, iconComponent)
		})
	}
}
